<template>
	<view>
		<view class="box">
			<view class="pl15 pr15 menu_content_box_page">
				<view class="mt15 area_block_1" v-for="item, index in list" :key="index" v-if="list.length > 0"
					@tap="toCheck(item)">
					<view class="flex_box">
						<view class="re mr15">
							<image :src="item.imgUrl" class="img17 vt"></image>
						</view>
						<view class="item">
							<view class="df fldc jcsb hp100">
								<view class="fs28 lh34 cor_333 ell">{{item.name}}</view>
								<view class="fs22 cor_808">卖家名称：{{item.sellerName}}</view>
								<view class="fs22 cor_808">卖家电话：{{item.phone}}</view>
								<view class="fs22 cor_808">提交时间：{{item.createTime}}</view>
							</view>
						</view>
					</view>
					<image v-if="item.state == 3" src="/static/icon_watermark_3.png" class="watermark_img_pos">
					</image>
					<image v-if="item.state == 2" src="/static/icon_watermark_1.png" class="watermark_img_pos">
					</image>
				</view>


				<view v-if="list.length == 0" style="width: 100%;height: 100vh;">
					<view style="height: 200rpx;"></view>
					<image src="../../static/excavator.png" style="width: 100%; padding: 100rpx 200rpx;"></image>
					<view style="width: 100%;text-align: center;color: #808080;">暂无数据</view>
				</view>
			</view><!-- pl15 pr15 -->
		</view><!-- box -->
	</view>
</template>

<script>
	import {
		toast,
		showLoading,
		hideLoading
	} from '@/utils/toast.js';
	import {
		getMyTestApi
	} from '@/http/api.js';
	export default {
		data() {
			return {
				list: [],
				pageIndex: 1,
				pageSize: 10,
				totalPage: 1,
				userId: uni.getStorageSync('userId')
			}
		},
		onLoad() {
			this.getMyTest();
		},
		onReachBottom() {
			this.getMyTest();
		},
		onBackPress(options) {
			uni.switchTab({
				url: '/pages/personal_center/personal_center'
			})
		},
		methods: {
			getMyTest() {
				let that = this;
				showLoading('加载中');
				getMyTestApi({
					userId: uni.getStorageSync('userId'),
					pageIndex: this.pageIndex,
					pageSize: this.pageSize
				}).then(res => {
					that.pageIndex = res.data.currentPage + 1;
					for (let i in res.data.data) {
						that.list.push(res.data.data[i])
					}
					hideLoading();
				}).catch(err => {
					hideLoading();
				})

			},

			toCheck(item) {
				if (item.state == 3) {
					uni.navigateTo({
						url: '/pages/purchase_information_details/purchase_information_details' + '?id=' + item.diggerId
					})
				} else {
					uni.navigateTo({
						url: '/pages/excavator_information_confirmation/excavator_information_confirmation' +
							'?id=' + item.id + '&diggerId=' + item.diggerId
					})
				}

			}

		}
	}
</script>

<style>
	.menu_content_box_page {
		position: relative;
		/* height: calc(100vh); */
		background-color: #f7f6f6;
	}

	.area_block_1 {
		position: relative;
		padding: 32rpx 120rpx 30rpx 20rpx;
		background-color: #fff;
		border-radius: 20rpx;
	}

	.watermark_img_pos {
		position: absolute;
		right: 10rpx;
		bottom: 18rpx;
		width: 92rpx;
		height: 92rpx;
		z-index: 2;
	}

	.view_report_btn {
		position: absolute;
		top: 50%;
		right: 0;
		width: 120rpx;
		height: 48rpx;
		line-height: 48rpx;
		font-size: 22rpx;
		color: #fff;
		text-align: center;
		background-image: linear-gradient(90deg, #f46933, #e3140b);
		border-radius: 24rpx 0 0 24rpx;
		z-index: 2;
		transform: translateY(-50%);
	}

	.consult_immediately_btn {
		display: block;
		height: 98rpx;
		line-height: 98rpx;
		text-align: center;
		font-size: 34rpx;
		font-weight: bold;
		color: #fff;
		background: linear-gradient(90deg, #f44f33, #e10d09);
	}
</style>
